package com.yugao.fintech.draper.log.event;

import com.yugao.fintech.draper.auth.dto.LoginLogDTO;
import com.yugao.fintech.draper.log.service.AsyncLogService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.event.EventListener;

@Slf4j
@RequiredArgsConstructor
public class AsyncLogListener {

	private final AsyncLogService asyncLogService;

	@EventListener(AsyncLogEvent.class)
	public void saveLog(AsyncLogEvent event) {
		LoginLogDTO loginLogDTO = (LoginLogDTO) event.getSource();
		asyncLogService.saveLog(loginLogDTO);
	}
}